package top.yongyan0624.entity;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;

/**
 * <p>
 * 
 * </p>
 *
 * @author yongyan
 * @since 2021-08-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SysUser extends BaseEntity {

    private static final long serialVersionUID = 1L;

    private String username;

    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    private String sex;

    private Integer age;

    private String avatar;

    private String bgImg;

    @Email(message = "邮箱格式不正确")
    private String email;

    private String phone;

    private String province;

    private String city;

    private String county;

    private String address;

    @TableField(exist = false)
    private Community community;

    @TableField(exist = false)
    private List<SysRole> roles = new ArrayList<>();

    @TableField(exist = false)
    private String token;    //邮箱验证码key

    @TableField(exist = false)
     @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String code;    //邮箱验证码value
}
